#include "lcd_app.h"
void lcd_clear_func(void);
void LCD_printf(uint8_t Line, char *format, ...)
{
    char string[21] = {0};
    va_list arg;
    va_start(arg, format);
    vsprintf(string, format, arg);
    va_end(arg);
    LCD_DisplayStringLine(Line, (u8 *)string);
}

pwm_t PA1 = {1000,10};
pwm_t PA7 = {1000,10};
uint8_t clear_flag;
uint8_t show_mode;//0:PA1  1:PA7
void lcd_proc(void)
{
	if(show_mode == 0)
    {
        lcd_clear_func();
        LCD_printf(Line3, "        PA1 ");
        LCD_printf(Line4, "      F:%dHz  ",PA1.freq);
        LCD_printf(Line5, "      D:%d%%  ", PA1.duty);
    }
    else
    {
        lcd_clear_func();
        LCD_printf(Line3, "        PA7 ");
        LCD_printf(Line4, "      F:%dHz  ", PA7.freq);
        LCD_printf(Line5, "      D:%d%%  ", PA7.duty);
    }
}

void lcd_clear_func(void)
{
    if (clear_flag != show_mode)
    {
        LCD_Clear(Black);
        clear_flag = show_mode;
    }
}